<!-- add by lty 20181222 -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>订单信息确认</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/orderConfirm.css">

    <script src="js/jquery/3.2.1/jquery.min.js"></script>
    <script src="js/orderConfirm.js"></script>
      <!-- 插件js -->
	<script src="../js/zepto.js"></script>
	<script src="../js/sm.js" ></script>
	<script src="../js/sm-extend.js" ></script>
	<script src="../js/request.js"></script>
	<script src="../../js/common.js"></script>
    <script type="text/javascript">
	window.$$=window.Zepto = Zepto;
	</script>
  </head>
  <body>
    <div class="page">
      <header class="bar bar-nav">
        <a class="button button-link button-nav pull-left" href="javascript:window.history.back();" data-transition='slide-out'>
          <span class="icon icon-left"></span>
          返回
        </a>
        <h1 class="title">订单信息确认</h1>
      </header>

      <!-- 主体内容 -->
      <div class="D_content">
        <div class="list-block list-block01">
          <ul>
            <li class="item-content">
              <a href="" class="item-inner">
                <div class="item-title">订单详情</div>
              </a>
            </li>
  
          </ul>
        </div>

        <div class="list-block list-block02">
          <ul>
            <li class="item-content item-link">
              <div class="item-media"><i class="icon icon-location"></i></div>
              <a class="item-inner serviceAddress">
                <div class="item-title no-choose esp1" id="server-address">请选择服务地址</div>
              </a>
            </li>
            <li class="item-content item-link">
              <div class="item-media"><i class="icon icon-clock2"></i></div>
              <a  class="item-inner time">
                <div class="item-title no-choose" id="server-time">请选择服务时间</div>
              </a>
            </li>
          </ul>
        </div>

        <div class="list-block list-block02">
          <ul>
            <li class="item-content">
              <div class="item-media"><i class="icon icon-phone"></i></div>
              <div class="item-inner">
                <div class="item-title">联系电话</div>
              </div>
            </li>
            <li class="item-content">
              <div class="item-inner">
                <input type="text" class="inner--input" id="server-phone" placeholder="请输入手机号" maxlength="11">
              </div>
            </li>
                      <li class="item-content">
              <div class="item-inner">
                <div class="item-title" id="ServiceMonths"><!-- 日常保洁*3 --></div>
                <div class="item-after" id="price" data-value="">0元 <span>5yu</span></div>
                
              </div>
              
            </li>
            <li class="item-content">
              <div class="item-inner">
                <div class="item-title" >购买小时</div>
                <div class="item-after" style="max-height: 2.2rem;" >
         	<div class="item-content">
          <div class="item-media"><i class="icon icon-form-gender"></i></div>
          <div class="item-inner">
            <div class="item-input">
              <select id="hour" onchange="changehour()" style=" touch-action: none; ">
					<option value="1">1小时</option>
					<option value="2">2小时</option>
					<option value="3">3小时</option>
					<option value="4">4小时</option>
					<option value="5">5小时</option>
					<option value="6">6小时</option>
					<option value="7">7小时</option>
					<option value="8">8小时</option>
					<option value="9">9小时</option>
			</select>
            </div>
          </div>
        </div>
                </div>
              </div>
            </li>
            <li class="item-content">
              <div class="item-media"><i class="icon icon-file-text"></i></div>
              <div class="item-inner">
                <div class="item-title">其他事项（选填）</div>
              </div>
            </li>
            <li class="item-content">
              <div class="item-inner">
                <input type="text" class="inner--input" placeholder="如上门前先打电话，特殊要求等" id="remark">
              </div>
            </li>
          </ul>
        </div>

        <div class="order--tips">
          温馨提示：预约服务后将有专人联系您，进行预约确认，服务收费。
        </div>

        <!-- 底部提交订单按钮 -->
        <div class="D_footer--block">
          <a href="javascript:;" class="add_order--btn" id="add_order--btn">
            确定预约
          </a>
        </div>
      </div>
    </div>
        <script type="text/javascript">
    var path = "/LanJuPublic";
   	var jiner=0;
   	var hours=1;
	var serviceId = Request.queryString("serviceId");
	var months = Request.queryString("months");
	var price = Request.queryString("price");
	var finalprice=price;
	var chargesType = Request.queryString("chargesType");
	var youhui=0;
	$(function(){
		window.addEventListener('touchmove', changehour, { passive: false });
		  $.ajax({
				url : "../../sharePrize/getMoneyByPhone.do",
				type : "POST",
				dataType : 'json',
				cache : false,
				success : function(ret){
					console.log(ret);
					if(ret.money!=null){
						jiner=ret.money.price;
					}
					$("#ServiceMonths").text("日常保洁*"+months);
					
					if(jiner!=0){
						youhui=(parseInt($("#hour").val())*5);
						finalprice=price-5;
					}
					$("#price").html(finalprice+"元<span style='color:red'>(优惠已抵扣"+youhui+"元)</span>");
					$("#price").attr("data-value",finalprice);
				}
			})
		
		$(".time").click(function(){
			window.location.href="serverTime.html?serviceId="+serviceId+"&chargesType="+chargesType+"&months="+months+"&price="+price;
		})
		$(".serviceAddress").click(function(){
			window.location.href="address.html?serviceId="+serviceId+"&chargesType="+chargesType+"&months="+months+"&price="+price;
		})
	})
	
	function toLink(id) {
		window.location.href="serviceList.html?serviceId="+id;
	}
	
	function changehour(){
		var price_temp=0;
		if(jiner!=0){
			price_temp=parseInt($("#hour").val())*5;
			hours=$("#hour").val();
			if(price_temp>jiner){
				$("#price").html((price*$("#hour").val())+"元<span style='color:red'>(余额不足)</span>");
			}else{
				$("#price").html((price*$("#hour").val()-price_temp)+"元<span style='color:red'>(优惠已抵扣"+(price_temp)+"元)</span>");
			}
		}else{
			$("#price").html((price*$("#hour").val()-price_temp)+"元<span style='color:red'>(优惠已抵扣0元)</span>");
		}
		
		$("#price").attr("data-value",(price*$("#hour").val()-price_temp));
		$("#ServiceMonths").text("日常保洁*"+(parseInt(months-1)+parseInt($("#hour").val())));
	}
	
</script>
  </body>
</html>